package com.jsoft.model;

import com.jsoft.dto.DiscountDto;
import com.jsoft.model.core.BaseDao;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;

/**
 * Date: 15.08.13
 * Time: 15:06
 */

@Entity
@Table(name = "discounts_margins")
public class DiscountMarginDao extends BaseDao {
    @Column(name = "name")
    private String name;
    @Column(name = "discount_value")
    private BigDecimal discountValue;
    @Column(name = "ismanual")
    private Boolean isManual;
    @Column(name = "isdisplace")
    private Boolean isDisplace;
    @Column(name = "ispercent")
    private Boolean isPercent;
    @Column(name = "isoncap")
    private Boolean isOnCap;
    @Column(name = "isDiscount")
    private Boolean isDiscount;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public BigDecimal getDiscountValue() {
        return discountValue;
    }

    public void setDiscountValue(BigDecimal discountValue) {
        this.discountValue = discountValue;
    }

    public Boolean getManual() {
        return isManual;
    }

    public void setManual(Boolean manual) {
        isManual = manual;
    }

    public Boolean getDisplace() {
        return isDisplace;
    }

    public void setDisplace(Boolean displace) {
        isDisplace = displace;
    }

    public Boolean getPercent() {
        return isPercent;
    }

    public void setPercent(Boolean percent) {
        isPercent = percent;
    }

    public Boolean getOnCap() {
        return isOnCap;
    }

    public void setOnCap(Boolean onCap) {
        isOnCap = onCap;
    }

    public Boolean getIsManual() {
        return isManual;
    }

    public void setIsManual(Boolean isManual) {
        this.isManual = isManual;
    }

    public Boolean getIsDisplace() {
        return isDisplace;
    }

    public void setIsDisplace(Boolean isDisplace) {
        this.isDisplace = isDisplace;
    }

    public Boolean getIsPercent() {
        return isPercent;
    }

    public void setIsPercent(Boolean isPercent) {
        this.isPercent = isPercent;
    }

    public Boolean getIsOnCap() {
        return isOnCap;
    }

    public void setIsOnCap(Boolean isOnCap) {
        this.isOnCap = isOnCap;
    }

    public Boolean getIsDiscount() {
        return isDiscount;
    }

    public void setIsDiscount(Boolean isDiscount) {
        this.isDiscount = isDiscount;
    }

    public DiscountDto wrapDiscountDto() {
        DiscountDto dto = new DiscountDto();
        dto.setId(this.getObjectId());
        dto.setName(this.getName());
        dto.setDisplace(this.getDisplace());
        dto.setManual(this.getManual());
        dto.setPercent(this.getPercent());
        dto.setOnCap(this.getOnCap());
        return dto;
    }

    public DiscountMarginDao wrapDiscountDao(DiscountDto dto) {
        DiscountMarginDao dao = new DiscountMarginDao();
        dao.setName(dto.getName());
        dao.setPercent(dto.getPercent());
        dao.setManual(dto.getManual());
        dao.setDisplace(dao.getDisplace());
        dao.setOnCap(dto.getOnCap());
        return dao;
    }
}
